(function () {
  'use strict';

  angular
    .module('vboxApp')
    .config(config)
    .config(blockUIConfig);

  /** @ngInject */
  function config($logProvider, $httpProvider, $locationProvider,$ocLazyLoadProvider,dialogsProvider) {
    // Enable log
    $logProvider.debugEnabled(true);
    //httpProvider config
    $httpProvider.defaults.useXDomain = true;


    //html5 config
    $locationProvider.html5Mode(true).hashPrefix('!');


    $ocLazyLoadProvider.config({
      debug: false
    });

    dialogsProvider.useFontAwesome();
  }
  /** @ngInject */
  function blockUIConfig(blockUIConfig) {
    blockUIConfig.message = '请求处理中...';
    blockUIConfig.delay = 100;
    blockUIConfig.autoBlock = true;
    blockUIConfig.template = '<div class=\"block-ui-overlay\"></div><div class=\"block-ui-message-container\" aria-live=\"assertive\" aria-atomic=\"true\"><div class=\"block-ui-message\" ng-class=\"$_blockUiMessageClass\"><i class=\"fa fa-refresh fa-spin\"></i></div></div>';
    blockUIConfig.requestFilter = function (config) {
      var message;
      switch (config.method) {
        case 'GET':
          message = '获取数据中 ...';
          break;
        case 'POST':
          message = '提交数据中 ...';
          break;
        case 'DELETE':
          message = '删除数据中 ...';
          break;
        case 'PUT':
          message = '更新数据中 ...';
          break;
      }
      return message;
    };
  }

})();
